package com.cy.pj.common.pojo;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor //无参构造函数
public class JsonResult  implements Serializable {
    private static final long serialVersionUID = 3516116200560836559L;//服务端响应到客户端
    /**
     * 状态码
     * */
    private Integer state=1 ; //1表示ok，0表示error
    /**响应信息*/
    private String message="ok";
    /**响应数据，一般为查询操作结果*/
    private Object data;

    public JsonResult(Throwable e){
        this(0,e.getMessage());
    }
    public JsonResult(Integer state) {
        this.state = state;
    }

    public JsonResult(String message) {
        this.message = message;
    }

    public JsonResult(Object data) {
        this.data = data;
    }

    public JsonResult(Integer state, String message) {
        this.state = state;
        this.message = message;
    }
//    public  JsonResult(ISelect select){
//        this.data= PageUtil.startPage().doSelectPageInfo(select);
//    }


}
